#coding:utf-8
import pymysql
import datetime

conn=pymysql.connect(host='localhost',user='root',password='111111',db='kblu',charset='utf8')

def save_rec(item):
	try:
		cmd = "insert into luer(title, img, thunder, updatetime, type, qqdl, ed2k, flashget, size, createtime) values ('%s','%s','%s','%s','%s','%s','%s','%s', '%s','%s')" %(item['title'], item['img'], item['thunder'], item['updatetime'], item['type'], item['qqdl'], item['ed2k'], item['flashget'], item['size'], datetime.datetime.now())
		print cmd
		cur=conn.cursor()
		return cur.execute(cmd)
	except Exception, e:
		print e

if __name__=='__main__':
	item = {
		'title' : u"我的他",
		'img' : u"sldkf",
		'thunder' : u"sdf",
		'updatetime' : u"2015-12-12",
		'type' : u'1',
		'qqdl' : u'12',
		'ed2k' : u'123',
		'flashget' : u'123',
		'size': u'1213'
	}
	save_rec(item)